//
//  CompanyNoticeViewController.m
//  XinKaiFa55like
//
//  Created by junseek on 2017/4/7.
//  Copyright © 2017年 55like lj. All rights reserved.
//

#import "CompanyNoticeViewController.h"
#import "RHTableView.h"
#import "NewsTableViewCell.h"
#import "SelectWebUrlViewController.h"

@interface CompanyNoticeViewController (){
    RHTableView *tabelViewC;
}

@end

@implementation CompanyNoticeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    tabelViewC=[[RHTableView alloc]initWithFrame:CGRectMake(0, kTopHeight, kScreenWidth, kContentHeight)];
    [tabelViewC showRefresh:YES LoadMore:YES];
    tabelViewC.delegate = self;
    tabelViewC.dataSource = self;
    //    tabelViewC.delegate2=self;
    [tabelViewC setBackgroundColor:rgbGray];
    [tabelViewC setSeparatorStyle:UITableViewCellSeparatorStyleNone];
    [tabelViewC registerClass:[NewsTableViewCell class] forCellReuseIdentifier:@"NewsTableViewCell"];
    [tabelViewC setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
    
    [self.view addSubview:tabelViewC];
    

}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self refreshTableData];
}


-(void)refreshTableData{
    tabelViewC.urlString=[NSString stringWithFormat:XKFV3usernotice,[[Utility Share] userId],[[Utility Share] userToken],@"%@"];
    [tabelViewC refresh];
}

#pragma mark tableView
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return tabelViewC.dataArray.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 95;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSDictionary *dic=[tabelViewC.dataArray objectAtIndex:indexPath.row];
    NewsTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"NewsTableViewCell" forIndexPath:indexPath];
    [cell setValueForDictionary:dic indexPath:indexPath type:@"companyNotice"];
    return cell;
    
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSDictionary *dic=[tabelViewC.dataArray objectAtIndex:indexPath.row];
    [self pushController:[SelectWebUrlViewController class] withInfo:@"" withTitle:@"  " withOther:dic];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
